@/*
    id : input框id
    name : input框名称
    value : value
@*/

<div class="form-group">
    <label class="lab">${name}</label>
    <div class="ele">
		<table class="table table-bordered">
			<thead>
				<tr>
					<th width="120px">节点名称</th>
					<th width="30px">
						<span class="icon icon-add" onclick="${id}_editor.addItem()" title="添加">&nbsp;&nbsp;&nbsp;&nbsp;</span>
					</th>
				</tr>
			</thead>
			<tbody id="${id}_tbody">
			</tbody>
		</table>
	</div>
</div>
<script type="text/template" id="${id}_itemTemplate">
	<tr>
		<td>
			<input class="textbox" type="text" name="${id}_result">
		</td>
		<td>
			<span class="icon icon-cancel" onclick="${id}_editor.delItem(this)" title="删除">&nbsp;&nbsp;&nbsp;&nbsp;</span>
		</td>
	</tr>
</script>
<script>
var ${id}_editor={}
${id}_editor.addItem = function(){
    $("#${id}_tbody").append($("#${id}_itemTemplate").html());
}
${id}_editor.delItem = function(obj){
    $(obj).parent().parent().remove();
}
${id}_editor.val = function(){
	var _ja = [];
    $("#${id}_tbody").find("tr").each(function(){
        var _result = $(this).find("[name='${id}_result']").val();
        var _jo = {
        	result:_result
        };
        _ja.push(_jo);
    });
    return JSON.stringify(_ja).replace(/\"/g,"\'");  
}
@if(isNotEmpty(value)){
$().ready(function(){
	var _val = '${value}';
	console.log(_val);
	var _ja = eval("("+_val+")");
	var _html = '';
	$.each(_ja,function(i,_jo){
		var _jo = _ja[i];
		console.log(_jo);
		_html += '<tr>';
		_html += '	<td><input class="textbox" type="text" name="${id}_result" value="'+_jo.result+'"></td>';
		_html += '	<td>';
		_html += '		    <span class="icon icon-cancel" onclick="${id}_editor.delItem(this)" title="删除">&nbsp;&nbsp;&nbsp;&nbsp;</span>';
		_html += '	</td>';
		_html += '</tr>';
	});
	$("#${id}_tbody").html(_html);
});
@}
</script>
@if(isNotEmpty(underline) && underline == 'true'){
    <div class="hr-line-dashed"></div>
@}


